package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ShoppingCartInfo {
	private int shopId;
	private String shopName;
	private	int productId;
	private String productTitle;
	private String productName;
	private String pic;
	private int width;
	private int height;
	private double tagPrice;
	private double salePrice;
	private boolean isSeleted;
	private int buyNum;
	private int num;
	private int addNum;
	private int actId;
	private int reserveNum;
	/*private int ishot;
	
	
	
	
	public int getIshot() {
		return ishot;
	}
	public void setIshot(int ishot) {
		this.ishot = ishot;
	}*/
	public int getActId() {
		return actId;
	}
	public void setActId(int actId) {
		this.actId = actId;
	}
	public String getProductName() {
		return productName;
	}
	public void setProductName(String productName) {
		this.productName = productName;
	}
	public int getAddNum() {
		return addNum;
	}
	public void setAddNum(int addNum) {
		this.addNum = addNum;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public int getShopId() {
		return shopId;
	}
	public void setShopId(int shopId) {
		this.shopId = shopId;
	}
	public String getShopName() {
		return shopName;
	}
	public void setShopName(String shopName) {
		this.shopName = shopName;
	}
	public int getProductId() {
		return productId;
	}
	public void setProductId(int productId) {
		this.productId = productId;
	}
	public String getProductTitle() {
		return productTitle;
	}
	public void setProductTitle(String productTitle) {
		this.productTitle = productTitle;
	}
	public String getPic() {
		return pic;
	}
	public void setPic(String pic) {
		this.pic = pic;
	}
	public int getWidth() {
		return width;
	}
	public void setWidth(int width) {
		this.width = width;
	}
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	public double getTagPrice() {
		return tagPrice;
	}
	public void setTagPrice(double tagPrice) {
		this.tagPrice = tagPrice;
	}
	public double getSalePrice() {
		return salePrice;
	}
	public void setSalePrice(double salePrice) {
		this.salePrice = salePrice;
	}
	public int getBuyNum() {
		return buyNum;
	}
	public void setBuyNum(int buyNum) {
		this.buyNum = buyNum;
	}
	
	public boolean isSeleted() {
		return isSeleted;
	}
	public void setSeleted(boolean isSeleted) {
		this.isSeleted = isSeleted;
	}
	
	
	
	public int getReserveNum() {
		return reserveNum;
	}
	public void setReserveNum(int reserveNum) {
		this.reserveNum = reserveNum;
	}
	public static List<ShoppingCartInfo> parse(JSONArray jsonArray) throws JSONException {
		List<ShoppingCartInfo> shoppingInfoList = new ArrayList<ShoppingCartInfo>();
		for(int j = 0;j<jsonArray.length();j++){
			ShoppingCartInfo cartInfo = new ShoppingCartInfo();
			JSONObject productJson = jsonArray.getJSONObject(j);
//			cartInfo.setBuyNum(productInfo.getInt("product_num"));
//			cartInfo.setTagPrice(productInfo.getDouble("price"));
//			cartInfo.setSalePrice(productInfo.getDouble("sale_price"));
//			cartInfo.setShopId(productInfo.getInt("shop_id"));
//			cartInfo.setProductTitle(productInfo.getString("product_title"));
//			cartInfo.setProductId(productInfo.getInt("product_id"));
//			cartInfo.setProductName(productInfo.getString("product_name"));
//			cartInfo.setPic(productInfo.getString("title_pic"));
//			cartInfo.setReserveNum(productInfo.getInt("reserveNum"));
			
			cartInfo.setSalePrice(productJson.getDouble("sale_price"));
			cartInfo.setHeight(productJson.getInt("height"));
			cartInfo.setProductTitle(productJson.getString("product_title"));
			cartInfo.setProductId(productJson.getInt("product_id"));
			cartInfo.setShopId(productJson.getInt("shop_id"));
			cartInfo.setBuyNum(productJson.getInt("buy_num"));
			cartInfo.setWidth(productJson.getInt("width"));
			cartInfo.setTagPrice(productJson.getInt("tag_price"));
			cartInfo.setPic(productJson.getString("pic"));
			cartInfo.setShopName(productJson.getString("shop_name"));
			cartInfo.setActId(productJson.getInt("act_id"));
			cartInfo.setReserveNum(productJson.getInt("reserveNum"));
			//cartInfo.setIshot(productJson.getInt("isHot"));
			shoppingInfoList.add(cartInfo);
		}
		return shoppingInfoList;
	}
	
	@Override
	public String toString() {
		return "ShoppingCartInfo [shopId=" + shopId + ", shopName=" + shopName
				+ ", productId=" + productId + ", productTitle=" + productTitle
				+ ", pic=" + pic + ", width=" + width + ", height=" + height
				+ ", tagPrice=" + tagPrice + ", salePrice=" + salePrice
				+ ", isSeleted=" + isSeleted + ", buyNum=" + buyNum + "]";
	}
	
	
	
	
}
